#include <iostream>

using namespace std;

class Person
{
public:
    Person()
    {
    }
    Person(int age, string name) : m_Age(age), m_Name(name)
    {
    }

    int m_Age;
    string m_Name;
};

/* struct test
{
    int age;
    string name;
}; */

int main()
{
    int size = 10;
    Person *arr = new Person[size];

    for (int i = 0; i < size; i++)
    {
        arr[i] = Person(i, "abc");
    }

    for (int i = 0; i < size; i++)
    {
        cout << arr[i].m_Age << endl;
    }

    delete[] arr;

    // int **arr[] = {};

    // *arr[0] = new int(10);

    // int len = sizeof(arr) / sizeof(arr[0]);
    // cout << len << endl;

    // // *arr[1] = new int(20);
    // // *arr[2] = new int(30);

    // cout << **arr[0] << endl;

    // delete arr[0];
    // delete arr[1];
    // delete arr[2];

    // for () {

    // }

    // cout << (*arr[0])->m_Age << endl;

    // for (int i = 0; i < 10; i++) {
    //     cout << arr[i] << endl;
    // }

    /* Person pArr[] = {Person(18, "张三"), Person(20, "李四")};

    // Person p1(18, "张三");
    Person p2(21, "王五");

    // pArr[0] = p1;
    pArr[2] = p2;

    cout << pArr[2].m_Name << endl; */

    // Person *pArr[] = {};

    // pArr[0] = new Person(18, "张三");

    // pArr[1] = new Person(20, "李四");

    // cout << pArr[1]->m_Age << endl;

    // for (int i = 0; i <= 100; i++) {
    //     pArr[i] = new Person(i, "张三");
    // }

    // cout << pArr[100]->m_Age << endl;

    /* Person **pArr[] = {};

    *pArr[0] = new Person(18, "张三");

    // *pArr[1] = new Person(20, "李四");

    // cout << (*pArr[0])->m_Age << endl;
    cout << (**pArr)->m_Age << endl;

    // *(*pArr + 1) = new Person(19, "张三");

    cout << pArr; */

    // cout << *(*pArr + 1)->m_Age << endl;
    /* test t = {123, "abc"};

    cout << t.age << endl;

    t.age = 233;

    cout << t.age << endl; */
    /*
    test t[] = {};

    t[0] = test{1, "a"};
    t[1] = test{1, "a"};

    cout << t[1].age << endl;

    int index = 0;
    t[index] = test{233, "vcc"};

    cout << t[index].age << endl; */

    return 0;
}